<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Discussion extends Model
{
    //
    protected $fillable = ['title','body','user_id','last_user_id'];

    public function user(){
        return $this->belongsTo(User::class,'user_id'); //外键默认是user_id,可以省略,要是别的了就要传
    }

    public function comments(){
        return $this->hasMany(Comment::class);
    }
}
